<?php

namespace App\Models;
<<<<<<< HEAD
use App\Models\Status;
=======


>>>>>>> user-statuses
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use  App\Models\Status;
class User extends Authenticatable
{
    use Notifiable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'email', 'password',
    ];
    public function gravatar($size = '100')
    {
      # code...
      $hash = md5(strtolower(trim($this->attributes['email'])));
      return "http://www.gravatar.com/avatar/$hash?s=$size";
    }
    public function SendsPasswordResetNotification($token)
    {
      # code...
      $this->notify(new ResetPassword($token));
    }
    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    public  static function boot()
    {
      # code...
       parent::boot();
       static::creating(function ($user)
       {
         # code...
         $user->activation_token=str_random(30);
       });


    }

    public function statuses()
    {
      # code...
      return  $this->hasMany(Status::class);

    }
    public function feed()
    {
        return $this->statuses()
                    ->orderBy('created_at', 'desc');
    }

    public function statuses()
   {
       return $this->hasMany(Status::class);
   }

   public function feed()
   {
     # code...
     return $this->statuses()
                  ->orderBy('created_at', 'desc');
   }
}
